 <template>
  <div class="app-container calendar-list-container">
    <div class="filter-container">
        <el-select size="small" class="filter-item" clearable v-model="listQuery.tradeType" placeholder="类别">
            <el-option label="支付" value="01"> </el-option>
            <el-option label="提现" value="02"> </el-option>
            <el-option label="退款" value="03"> </el-option>
            <el-option label="充值" value="04"> </el-option>
        </el-select>
        <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入订单号" v-model="listQuery.orderNo"></el-input>
        <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查询</el-button>
    </div>
    <!-- 查询结果 -->
    <el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
            <el-table-column align="center" min-width="120px" label="订单号" prop="orderNo"></el-table-column>
            <el-table-column align="center" min-width="100px" label="账户编号" prop="accountId"></el-table-column>
            <el-table-column align="center" min-width="150px" label="账务流水号" prop="journalId"></el-table-column>
            <el-table-column align="center" min-width="80px" label="交易类型">
                <template slot-scope="scope">
                    <span v-if="scope.row.tradeType == '01'">支付</span>
                    <span v-if="scope.row.tradeType == '02'">提现</span>
                    <span v-if="scope.row.tradeType == '03'">退款</span>
                    <span v-if="scope.row.tradeType == '04'">充值</span>
                </template>
            </el-table-column>
            <el-table-column align="center" min-width="80px" label="金额" prop="tradeAmt"></el-table-column>                              
            <el-table-column align="center" min-width="100px" label="时间" prop="createTime" sortable></el-table-column>
    </el-table>
    <div v-show="!listLoading" class="pagination-container">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page" :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
    </div>
  </div>
</template>

<script>
import { pageAll } from '@/api/crm/customers/merchantAccountJournal'
import { mapGetters } from 'vuex'
export default {
  name: 'functionList',
  data() {
    return {
      list: null,
      total: null,
      listLoading: true,
      listQuery: {
        orderNo: '',
        tradeType: '',
        page: 1,
        limit: 20,
        platformId: ''
      },
      tableKey: 0
    }
  },
  created() {
    this.getList()
  },
  computed: {
    ...mapGetters(['elements', 'platformId'])
  },
  methods: {
    getList() {
      this.listLoading = true
      this.listQuery.platformId = this.platformId
      pageAll(this.listQuery).then(response => {
        this.list = response.data.rows
        this.total = response.data.total
        this.listLoading = false
      })
    },
    handleFilter() {
      this.getList()
    },
    handleSizeChange(val) {
      this.listQuery.limit = val
      this.getList()
    },
    handleCurrentChange(val) {
      this.listQuery.page = val
      this.getList()
    }
  }
}
</script>
